<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/24 0024
 * Time: 上午 10:11
 */

namespace app\admin\controller;


use controller\BasicAdmin;
use service\DataService;

class Slider extends BasicAdmin
{
    public $table = 'Slider';
    public function index(){
        $this->title = '首页轮播图';
        $db = \app\admin\model\Slider::order('sort asc,id desc');
        return parent::_list($db);
    }

    public function add(){
        return $this->_form($this->table,'form');
    }

    public function forbid(){
        DataService::update($this->table);
        $this->success('禁用成功！','');
    }

    public function resume(){
        DataService::update($this->table);
        $this->success('启用成功！','');
    }

    public function del(){
        DataService::update($this->table);
        $this->success('删除成功！','');
    }
}